﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <link href="../../WF/Portal/layui/css/layui.css" rel="stylesheet" />
    <script type="text/javascript" src="../../WF/Scripts/bootstrap/js/jquery.min.js"></script>
    <script type="text/javascript" src="../../WF/Scripts/bootstrap/js/bootstrap.min.js"></script>
    <script src="../../WF/Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../WF/Scripts/config.js" type="text/javascript"></script>
    <script src="../../WF/Comm/Gener.js" type="text/javascript"></script>
    <script src="../../WF/Portal/layui/layui.js" type="text/javascript"></script>
    <script src="../../WF/Scripts/layui/LayuiDialog.js" type="text/javascript"></script>
    <script src="../../WF/Portal/js/vue/vue.js" type="text/javascript"></script>
    <script src="../layuiadmin/layui/lay/modules/layer.js"></script>
    <script src="wangeditor/wangEditor.min.js"></script>
    <style>
        .know {
            width: 80%;
            margin: 10px auto
        }
    </style>
</head>
<body>
    <div class="know" id="know-Edit">
        <form>
            <div class="layui-form-item">
             
                    <input placeholder="请输入内容" name="TB_Name" id="TB_Name" class="layui-input" :value="knowInfo.Name">
               
            </div>
            <div class="layui-form-item">
             
               
                    <div id="editor">
                       
                    </div>
             
                </div>
                <div class="layui-form-item">
                 
                        <span type="submit" class="layui-btn layui-btn-normal" @click.stop="SaveKnow()">立即提交</span>
                        <span @click.stop="close()" class="layui-btn layui-btn-primary">取消</span>
                 
                </div>
</form>
    </div>

    <script>
        var knno = GetQueryString("no");
        new Vue({
            el: '#know-Edit',
            data: {
                knowInfo: [],
                KnowledgeNo: '',
                editor: null
            },
            methods: {
                init: function () {
                    const E = window.wangEditor;
                    this.editor = new E('#editor');
                  
                    this.editor.config.menus = [
                        'bold',
                        'head',
                        'link',
                        'italic',
                        'underline'
                    ]
                    this.editor.create();
                    this.editor.txt.html(this.knowInfo.Docs)
                },
                close: function () {
                    //console.log(this.KnowledgeNo)
                   
                    //window.location.href = "Knowledge.htm?no=" + this.KnowledgeNo;
                },
                SaveKnow: function () {
                    console.log(this.editor.txt.html());
                    var en = new Entity("BP.CCOA.KnowledgeManagement.KMDtl", knno);
                    en.Docs = this.editor.txt.html()
                    en.CopyForm();
                    en.Update();
                    layer.msg('修改成功', { time: 1000 }, function () {
                        parent.location.reload();
                    })
                    
                },

            },
            mounted: function () {
                var pageData = new Entity("BP.CCOA.KnowledgeManagement.KMDtl", knno);
                this.KnowledgeNo = pageData.KnowledgeNo
                this.knowInfo = pageData;
                console.log(pageData)
                this.init()

            }

        });

    </script>

</body>
</html>